# 目录基本信息 
export cddata_dir=/home/soft/docker-container/docker-container/mis-zsh/cddata
export mis_base_dir=/home/soft/docker-container/docker-container/mis-zsh/scdeap
export mis_web_dir=/home/soft/docker-container/docker-container/mis-zsh/scdeapWeb

# 发布的版本信息 
export mis_zsh_version=zsh-20250418-tmp-1


# 默认cp 是 cp -i 的别名, 覆盖需要输入y, 可以去掉, 保险起见可以保留别名, 
unalias cp


cd $cddata_dir
# 上传 zsh-20250320-tmp-1.zip
# 解压缩 zip 文件

mkdir $mis_zsh_version
unzip $mis_zsh_version.zip -d $mis_zsh_version
mkdir -p $mis_zsh_version/backup/lib


export work_dir=$cddata_dir/$mis_zsh_version
cd $work_dir

# 备份 

# 备份 - jar 
cp $mis_base_dir/WEB-INF/lib/flow-client-1.0.1-SNAPSHOT.jar  $work_dir/backup/lib/
cp $mis_base_dir/WEB-INF/lib/scdeap-basicarchives-1.0-SNAPSHOT.jar  $work_dir/backup/lib/
cp $mis_base_dir/WEB-INF/lib/scdeap-buss-common-1.0-SNAPSHOT.jar  $work_dir/backup/lib/
cp $mis_base_dir/WEB-INF/lib/scdeap-esp-1.0-SNAPSHOT.jar  $work_dir/backup/lib/
cp $mis_base_dir/WEB-INF/lib/scdeap-inspection-1.0-SNAPSHOT.jar  $work_dir/backup/lib/
cp $mis_base_dir/WEB-INF/lib/scdeap-jasypt-sm-1.0-SNAPSHOT.jar  $work_dir/backup/lib/
cp $mis_base_dir/WEB-INF/lib/scdeap-metrics-1.0-SNAPSHOT.jar  $work_dir/backup/lib/
cp $mis_base_dir/WEB-INF/lib/scdeap-supervise-1.0-SNAPSHOT.jar  $work_dir/backup/lib/
cp $mis_base_dir/WEB-INF/lib/scdeap-system-1.0-SNAPSHOT.jar  $work_dir/backup/lib/

ll $work_dir/backup/lib

# 备份 - excel 模板
cp -r $mis_base_dir/WEB-INF/classes/excelTemplate $work_dir/backup/

cp -r $mis_base_dir/WEB-INF/views $work_dir/backup/

# 备份 - 前端
cp -r $mis_web_dir  $work_dir/backup/

# 前端 配置覆盖 js/conf 目录
cp -rf $work_dir/backup/scdeapWeb/js/conf/* scdeapWeb/js/conf/

# 部署 lib 
cp -f $work_dir/lib/* $mis_base_dir/WEB-INF/lib/

# 部署 excelTemplate
cp -f $work_dir/excelTemplate/* $mis_base_dir/WEB-INF/classes/excelTemplate/


cp -f $work_dir/WEB-INF/views/modules/applyreturn $mis_base_dir/WEB-INF/views/modules/

# 部署 web , 避免 使用 rm -rf ./* 所以先移动到 ready_del 目录, 固定删除 ready_del 目录
rm -rf $work_dir/ready_del
mkdir $work_dir/ready_del
mv $mis_web_dir/* $work_dir/ready_del/

cp -r $work_dir/scdeapWeb/* $mis_web_dir/


docker-compose restart scdeap

docker-compose logs --tail=10 -f scdeap
